<?php
/**
 * Created by PhpStorm.
 * User: zhanglin02
 * Date: 2016/3/31
 * Time: 11:19
 */

namespace Admin\Controller;
use Think\Controller;

class CommonController extends Controller
{
    public function __construct(){
        parent::__construct();//先执行父类的构造方法
        $this->checkUser();//后边所有的类都继承于此，所以先执行checkUser检查是否已经登录
        $this->assign('admin_name',session('userinfo.name'));
    }
    public function checkUser(){
        if(!session('userinfo')){
            $this->redirect('Login/index');
        }
    }
}